<?php

//Aug 19, 2010: immanuel192 rewrite this code

if (!defined('EXPONENT')) exit('');

$tag = null;
if (isset($_GET['id'])) {
	$tag = $db->selectObject('cufonmodule_items','id='.intval($_GET['id']));
	if ($tag) {
		$loc = unserialize($tag->location_data);
	}
}

if (($tag && exponent_permissions_check('administrate',$loc)) || (!$tag && exponent_permissions_check('administrate',$loc))) {
	$form = cufon_item::form($tag);
	$form->location($loc);
	$form->meta('action','save');
	
	$template = new template('cufonmodule','_form_edit');
	$template->assign('is_edit',(isset($tag->id)? 1 : 0));
	$template->assign('form_html',$form->toHTML());
	$template->output();
} else {
	echo SITE_404_HTML;
}

?>
